Creating conditional actions

Use the If statement to set up statements that run only when a certain condition exists. For example, you can check the value a user entered in a text field and display a message if the value is too high or too low. To use the If statement effectively, you should be familiar with creating expressions that evaluate conditions. See Writing expressions.

For every If statement, the statement End If marks the end of the statements that run if the condition is still true. If you want an action to respond to one of several possibilities, use a series of If statements. An If statement can also contain an Else statement that designates an alternate series of statements to run if the condition is false (zero).

Statements within the If and End if statements are indented. The indented statements run only if the condition is true. Otherwise, Flash ignores the indented statements.

For each Else statement, select the original If statement, and then click the "Add Else/Else if clause" button. Each click adds another Else clause. Set the Else if clause by selecting an individual Else clause and clicking the Else if radio button in the Parameters pane.

For example, this action uses If with Else if and Else to direct different users to different scenes in a movie. If the variable name doesn't equal any of the names mentioned, then a standard welcome scene starts:

If (name eq "Gary")
	Go to and Play ("Gary's World", 1)
Else if (name eq "David")
	Go to and Play ("David's World", 1)
Else if (name eq "Peter")
	Go to and Play ("Peter's World", 1)
Else 
	Go to and Play ("Welcome", 1)
End If